
<%@page import="org.biojava.services.das.dao.CourseManager"%>
<%@ page import="org.biojava.services.das.dao.Role" %>
<%@ page import="org.biojava.services.das.dao.RegistryUser" %>
<%@ page import="org.biojava.services.das.registry.UserManager" %>




<%
	String title = "login DAS registration server";
	String header = title;
%>


<%@ include file="sangerheader.jsp"%>


<div id="main">




 <%

session=request.getSession();
String message=(String) session.getAttribute("message");
if (message != null) {
%><p><strong><%=message%></strong></p><%
	session.removeAttribute("message");
}


		if (request.getParameter("logout") != null) {
%> <p><strong>You have been logged out.</strong></p> <%
 }
 %>

<%
	// take care of cookies

	
	Cookie myCookie = null;
	Cookie[] cookies=request.getCookies();
	if (cookies != null) {
		for (int i = 0; i < cookies.length; i++) {
			if (cookies[i].getName().equals("claimedEmailName")) {
		myCookie = cookies[i];
		break;
			}
		}
	}
	String claimedEmailName = "";
	if ( myCookie != null ) 
		claimedEmailName = myCookie.getValue();
		
	
%>

<h2>Login using email and password</h2>
The registry does not use open-id to manage accounts anymore. If you have an open-id account registered with the DAS registry then please follow this <a href="sendMeMyPass.jsp">link</a>, type in the email address associated with your account and follow the instructions. 

<br/>
<br/>
<%
if (session.getAttribute("email") == null) {
%>

<form method="POST" action="authentication">
<table>
<tr>
<td><strong>email:</strong> </td>
<td><input class="email" type="text" name="email" size="40" value=""/> <a href="sendMeMyPass.jsp"> I have forgotten my password </a></td>
</tr>
<tr>
<td>Password:</td><td><input  type="password" name="password" size="40" value=""/></td>
<tr/>
<tr>
<td>remember me:<input type="checkbox" name="remember" VALUE="1"<% 

	if ( ! ( claimedEmailName.equals(""))) {
		out.print("checked");
	}

%>> </td></tr>
<tr><td >&nbsp;</td><td align="right"><input type="submit" value="login"/></td></tr>
</table>
</form>

Please provide your email and password <br/>

<h2>New Registration</h2>
I would like to <a href="loginSettings.jsp?action=create">register</a> 


<%
} else {
	
%>
<ul>
<li>You are logged in as <% 
if ( isAdmin ) {
	%><strong>admin user</strong> <% 
}%><b><%= email %></b></li>
<li><a href="loginSettings.jsp">view</a> your account settings</li>


</ul>



<br/><br/>
[ <a href="login.jsp?logout=true">Log out</a> ]
<%
}
%>

</div>

<%@ include file="sangerfooter.jsp"%>
